home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / include / linux / init_task.h < prev    next >
C/C++ Source or Header  |  2005-10-13  |  3KB  |  120 lines

  1. #ifndef _LINUX__INIT_TASK_H
  2. #define _LINUX__INIT_TASK_H
  3.  
  4. #include <linux/file.h>
  5.  
  6. #define INIT_FILES \
  7. {                             \
  8.     .count        = ATOMIC_INIT(1),         \
  9.     .file_lock    = SPIN_LOCK_UNLOCKED,         \
  10.     .max_fds    = NR_OPEN_DEFAULT,         \
  11.     .max_fdset    = __FD_SETSIZE,         \
  12.     .next_fd    = 0,                 \
  13.     .fd        = &init_files.fd_array[0],     \
  14.     .close_on_exec    = &init_files.close_on_exec_init, \
  15.     .open_fds    = &init_files.open_fds_init,     \
  16.     .close_on_exec_init = { { 0, } },         \
  17.     .open_fds_init    = { { 0, } },             \
  18.     .fd_array    = { NULL, }             \
  19. }
  20.  
  21. #define INIT_KIOCTX(name, which_mm) \
  22. {                            \
  23.     .users        = ATOMIC_INIT(1),        \
  24.     .dead        = 0,                \
  25.     .mm        = &which_mm,            \
  26.     .user_id    = 0,                \
  27.     .next        = NULL,                \
  28.     .wait        = __WAIT_QUEUE_HEAD_INITIALIZER(name.wait), \
  29.     .ctx_lock    = SPIN_LOCK_UNLOCKED,        \
  30.     .reqs_active    = 0U,                \
  31.     .max_reqs    = ~0U,                \
  32. }
  33.  
  34. #define INIT_MM(name) \
  35. {                                 \
  36.     .mm_rb        = RB_ROOT,                \
  37.     .pgd        = swapper_pg_dir,             \
  38.     .mm_users    = ATOMIC_INIT(2),             \
  39.     .mm_count    = ATOMIC_INIT(1),             \
  40.     .mmap_sem    = __RWSEM_INITIALIZER(name.mmap_sem),    \
  41.     .page_table_lock =  SPIN_LOCK_UNLOCKED,         \
  42.     .mmlist        = LIST_HEAD_INIT(name.mmlist),        \
  43.     .cpu_vm_mask    = CPU_MASK_ALL,                \
  44.     .default_kioctx = INIT_KIOCTX(name.default_kioctx, name),    \
  45. }
  46.  
  47. #define INIT_SIGNALS(sig) {    \
  48.     .count        = ATOMIC_INIT(1),         \
  49.     .wait_chldexit    = __WAIT_QUEUE_HEAD_INITIALIZER(sig.wait_chldexit),\
  50.     .shared_pending    = {                 \
  51.         .list = LIST_HEAD_INIT(sig.shared_pending.list),    \
  52.         .signal =  {{0}}}, \
  53.     .posix_timers     = LIST_HEAD_INIT(sig.posix_timers),        \
  54.     .rlim        = INIT_RLIMITS,                    \
  55. }
  56.  
  57. #define INIT_SIGHAND(sighand) {                        \
  58.     .count        = ATOMIC_INIT(1),                 \
  59.     .action        = { { { .sa_handler = NULL, } }, },        \
  60.     .siglock    = SPIN_LOCK_UNLOCKED,                 \
  61. }
  62.  
  63. extern struct group_info init_groups;
  64.  
  65. /*
  66.  *  INIT_TASK is used to set up the first task table, touch at
  67.  * your own risk!. Base=0, limit=0x1fffff (=2MB)
  68.  */
  69. #define INIT_TASK(tsk)    \
  70. {                                    \
  71.     .state        = 0,                        \
  72.     .thread_info    = &init_thread_info,                \
  73.     .usage        = ATOMIC_INIT(2),                \
  74.     .flags        = 0,                        \
  75.     .lock_depth    = -1,                        \
  76.     .prio        = MAX_PRIO-20,                    \
  77.     .static_prio    = MAX_PRIO-20,                    \
  78.     .policy        = SCHED_NORMAL,                    \
  79.     .cpus_allowed    = CPU_MASK_ALL,                    \
  80.     .mm        = NULL,                        \
  81.     .active_mm    = &init_mm,                    \
  82.     .run_list    = LIST_HEAD_INIT(tsk.run_list),            \
  83.     .time_slice    = HZ,                        \
  84.     .tasks        = LIST_HEAD_INIT(tsk.tasks),            \
  85.     .ptrace_children= LIST_HEAD_INIT(tsk.ptrace_children),        \
  86.     .ptrace_list    = LIST_HEAD_INIT(tsk.ptrace_list),        \
  87.     .real_parent    = &tsk,                        \
  88.     .parent        = &tsk,                        \
  89.     .children    = LIST_HEAD_INIT(tsk.children),            \
  90.     .sibling    = LIST_HEAD_INIT(tsk.sibling),            \
  91.     .group_leader    = &tsk,                        \
  92.     .real_timer    = {                        \
  93.         .function    = it_real_fn                \
  94.     },                                \
  95.     .group_info    = &init_groups,                    \
  96.     .cap_effective    = CAP_INIT_EFF_SET,                \
  97.     .cap_inheritable = CAP_INIT_INH_SET,                \
  98.     .cap_permitted    = CAP_FULL_SET,                    \
  99.     .keep_capabilities = 0,                        \
  100.     .user        = INIT_USER,                    \
  101.     .comm        = "swapper",                    \
  102.     .thread        = INIT_THREAD,                    \
  103.     .fs        = &init_fs,                    \
  104.     .files        = &init_files,                    \
  105.     .signal        = &init_signals,                \
  106.     .sighand    = &init_sighand,                \
  107.     .pending    = {                        \
  108.         .list = LIST_HEAD_INIT(tsk.pending.list),        \
  109.         .signal = {{0}}},                    \
  110.     .blocked    = {{0}},                    \
  111.     .alloc_lock    = SPIN_LOCK_UNLOCKED,                \
  112.     .proc_lock    = SPIN_LOCK_UNLOCKED,                \
  113.     .switch_lock    = SPIN_LOCK_UNLOCKED,                \
  114.     .journal_info    = NULL,                        \
  115. }
  116.  
  117.  
  118.  
  119. #endif
  120.